﻿using Handy_DNS.View.Pages;
using Handy_DNS.View.UserControl.Menu;
using Handy_WPF.MVVM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace Handy_DNS.ViewModel
{
    public class MainWindowViewModel : NotificationProperty
    {
        public MainWindowViewModel()
        {
            _menuMainC = new MenuMainContent(MenuChange);
        }

        #region 菜单
        /// <summary>
        /// 单例，懒加载
        /// </summary>
        private static readonly Lazy<MenuMainViewModel> _menuMainVM
            = new Lazy<MenuMainViewModel>(() => new MenuMainViewModel());

        public MenuMainViewModel MenuMainVM
        {
            get
            {
                return _menuMainVM.Value;
            }
        }

        /// <summary>
        /// 菜单页面
        /// </summary>
        private readonly MenuMainContent _menuMainC;
        public MenuMainContent MenuMainC
        {
            get
            {
                return _menuMainC;
            }
        } 
        #endregion

        #region 菜单路径
        private void MenuChange(string pagePath)
        {
            PagePath = pagePath;
        }

        private string _pagePath = string.Empty;

        public string PagePath
        {
            get { return _pagePath; }
            set 
            {
                if (_pagePath != value)
                {
                    _pagePath = value; 
                    RaisePropertyChanged("PagePath");
                }
            }
        }
        #endregion
    }
}
